# RUN: yaml2obj %S/Inputs/basic-elf.yaml -o %T/inline-record.out
# RUN: %lldb %T/inline-record.out -o "target symbols add -s inline-record.out %S/Inputs/inline-record.syms" \
# RUN:   -s %s | FileCheck --match-full-lines %s

# CHECK-LABEL: (lldb) image lookup -a 0x400010 -v
# CHECK:       Summary: inline-record.out`f1 [inlined] inlined_f1 at a.c:3
# CHECK-NEXT:           inline-record.out`f1 at a.c:8
# CHECK:      Function: id = {{.*}}, name = "f1", range = [0x0000000000400010-0x0000000000400020)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400010-0x00400020)
# CHECK-NEXT:           id = {{.*}}, ranges = [0x00400010-0x00400015)[0x00400017-0x0040001b), name = "inlined_f1"

# CHECK-LABEL: (lldb) image lookup -a 0x400016 -v
# CHECK:       Summary: inline-record.out`f1 + 6 at a.c:3
# CHECK-NOT:            inline-record.out`f1
# CHECK:      Function: id = {{.*}}, name = "f1", range = [0x0000000000400010-0x0000000000400020)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400010-0x00400020)

# CHECK-LABEL: (lldb) image lookup -a 0x400023 -v
# CHECK:      Summary: inline-record.out`f2 + 3 [inlined] inlined_f2 at b.c:2
# CHECK-NEXT:          inline-record.out`f2 + 3 [inlined] inlined_f1 at b.c:4
# CHECK-NEXT:          inline-record.out`f2 + 3 at a.c:3
# CHECK:      Function: id = {{.*}}, name = "f2", range = [0x0000000000400020-0x0000000000400030)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400020-0x00400030)
# CHECK-NEXT:           id = {{.*}}, range = [0x00400023-0x0040002d), name = "inlined_f1"
# CHECK-NEXT:           id = {{.*}}, range = [0x00400023-0x00400028), name = "inlined_f2"

# CHECK-LABEL: (lldb) image lookup -a 0x400029 -v
# CHECK:      Summary: inline-record.out`f2 + 9 [inlined] inlined_f1 + 6 at b.c:2
# CHECK-NEXT:          inline-record.out`f2 + 3 at a.c:3
# CHECK:      Function: id = {{.*}}, name = "f2", range = [0x0000000000400020-0x0000000000400030)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400020-0x00400030)
# CHECK-NEXT:           id = {{.*}}, range = [0x00400023-0x0040002d), name = "inlined_f1"

# CHECK-LABEL: (lldb) image lookup -a 0x400030 -v
# CHECK:       Summary: inline-record.out`f3 [inlined] inlined_f1 at b.c:3
# CHECK-NEXT:           inline-record.out`f3 at 3
# CHECK:      Function: id = {{.*}}, name = "f3", range = [0x0000000000400030-0x0000000000400040)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400030-0x00400040)
# CHECK-NEXT:           id = {{.*}}, range = [0x00400030-0x00400035), name = "inlined_f1"


# CHECK-LABEL: (lldb) image lookup -a 0x400035 -v
# CHECK:      Summary: inline-record.out`f3 + 5 [inlined]  at b.c:3
# CHECK-NEXT:          inline-record.out`f3 + 5 at a.c:3
# CHECK:      Function: id = {{.*}}, name = "f3", range = [0x0000000000400030-0x0000000000400040)
# CHECK-NEXT:   Blocks: id = {{.*}}, range = [0x00400030-0x00400040)
# CHECK-NEXT:           id = {{.*}}, range = [0x00400035-0x0040003a)

image lookup -a 0x400010 -v
image lookup -a 0x400016 -v
image lookup -a 0x400023 -v
image lookup -a 0x400029 -v
# Folling addresses are inside INLINE records that have file index or origin index out of range.
image lookup -a 0x400030 -v
image lookup -a 0x400035 -v
exit
